package com.summer.Collection;

import java.util.*;

public class CollectionTest {
    public static void main(String[] args) {
        Collection coll = new ArrayList();
        coll.add("AA");
        coll.add("BB");
        coll.add(123);
        coll.add(new Date());
//        System.out.println(coll.size());
        Collection coll2 = new ArrayList();
        coll2.add(456);
        coll2.add("cc");
        coll.addAll(coll2);
//        System.out.println(coll);
//        System.out.println(coll.size());
//        System.out.println(coll.contains(456));
//        System.out.println(coll.containsAll(coll2));
//        coll.remove("cc");
//        Collection coll1 = Arrays.asList(123, 456);
//        coll.retainAll(coll1);//交集
//        coll.removeAll(coll1);
//        System.out.println(coll.hashCode());
//        Object[] objects = coll.toArray();

        Iterator iterator = coll.iterator();
        while (iterator.hasNext()){
            System.out.println("迭代----"+iterator.next());
        }
        for(Object o: coll){
            System.out.println("增强for----"+o);
        }
    }
}
